package com.ebupt.migu.music.kafka.entity;

import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

@Component
public class KafkaProducer {

    @Autowired
    private KafkaTemplate<String,String> kafkaTemplate;

    public void sendMsg(KafkaMsg kafkaMsg){
        kafkaTemplate.send("tz",new Gson().toJson(kafkaMsg));
    }
}
